package net;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;

public class Server {
	public static HashMap<String,ClientThread> clientPool = new HashMap<String,ClientThread>();
	
	final int port = 8888;
	
	public Server(){
		try {
			ServerSocket ss = new ServerSocket(port);
			System.out.println("服务器开启...");
			
			while (true){
				Socket tcpConnection = ss.accept();
				ClientThread ct = new ClientThread(tcpConnection);
				System.out.println("IP地址为：" + tcpConnection.getInetAddress().getHostAddress() +"的用户打开客户端");
				ct.start();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		new Server();
	}
}